package com.huizhe.modules.service;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huizhe.core.config.datasource.DataSource;
import com.huizhe.core.config.datasource.DataSourceEnum;
import com.huizhe.modules.entity.Teacher;
import com.huizhe.modules.mapper.TeacherMapper;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

@Service
public class TeacherService extends ServiceImpl<TeacherMapper, Teacher> implements IService<Teacher> {

    @DataSource(DataSourceEnum.DB2)
    public boolean insert(Teacher entity) {
        return super.save(entity);
    }

    @Override
    @DataSource(DataSourceEnum.DB2)
    public boolean removeById(Serializable id) {
        return super.removeById(id);
    }

    @Override
    @DataSource(DataSourceEnum.DB2)
    public boolean updateById(Teacher entity) {
        return super.updateById(entity);
    }

    @DataSource(DataSourceEnum.DB2)
    public Teacher selectById(String id) {
        return super.getById(id);
    }

    @DataSource(DataSourceEnum.DB2)
    public List<Teacher> selectList() {
        return super.list();
    }

    @DataSource(DataSourceEnum.DB2)
    public Page<Teacher> selectPage(Page<Teacher> page, Wrapper<Teacher> wrapper) {
        return super.page(page, wrapper);
    }
}
